<%@page import="java.util.HashMap"%>
<%@page import="service.FindCart"%>
<%@page import="java.util.List"%>
<%@page import="entity.Book"%>
<%@page import="entity.Member"%>
<%@page import="dao.MemberDao"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page errorPage="error.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" charset="utf-8" />
        <style>
            p{
                display: block;
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
                width: 70%;
                }
                a{
                    text-decoration:none;
                    
                }
                #kuang{
                   
                    margin-left:250px; 
                    width: 1150px;
                    height: 1500px;
                    border: 1px black solid;
                    margin-top: 40px;
                     background: url(img/购物车背景内.jpg) no-repeat; background-size: 100% 100%;
                }
                div{border-radius: 10px; }
        </style>
    </head>
    <body style=" background-color: whitesmoke">
        <div>
        <div style="margin-left: 10px;width:1200px;">
                <%
                    String name=(String)session.getAttribute("username");
                %>
                <div style="background: url(img/购物车背景上.jpg) no-repeat; background-size: 100% 100%; width: 1660px; height:150px;">
                <img src="img/购物车.jpg" style="border-radius: 10px" width="150px" height="130px">
                <div style="position: absolute;left:1400px;top:30px;font-size: 35px ;font-weight:bold; ">
                    <a  style="color: darkgray;"href="Member.jsp?name=<%=name%>">个人中心</a>
                </div>
                <div style=" height: 20px; widows: 1670px;box-shadow: 0px 5px 5px grey"></div>
                </div>
                    <br>
                    <div style="margin-left: 300px; margin-top:0px;font-size: 30px ;font-weight:bold;">
                        <a href="BuyAll.jsp" class="btn btn-success btn-lg">全部购买</a>
                    </div>
                
                
                
                
                <div id="kuang">
                <%

                    Member member=new MemberDao().getMemberByName(name);
                    List<Book> list=new FindCart().findCart(member.getId());
                    for(Book book:list){
                        int count=new FindCart().findCartCount(member.getId(), book.getId());
                        int i=1;
                %>
                    <div style=" float: left;margin:10px 10px;width:550px; border: 1px bisque solid; background-color: blanchedalmond;border-radius: 20px;">
                        
                        <div style=" float: left;margin:0px 10px; width: 220px;">
                            <p style=" font-size: 20px;text-align:center;"><%=book.getBookName()%></p>
                            <img src="img/<%=book.getCover()%>" style="border-radius: 10px" width="200px" height="280px" alt="<%=book.getBookName()%>">
                        </div>
                        <div style=" float:left; margin:70px 10px; width:240px;">
                            <p>编号：<%=book.getId()%></p>
                            <p>作者：<%=book.getAuthor()%></p>
                            <p>数量：<%=count%>本</p>
                            <p>单价：<%=book.getPrice()%>元</p>
                            <form name="ff"   action="mcs?bookid=<%=book.getId()%>"  method="post" >
                                <div style=" height: 20px;">
                <div style=" width: 200px;" >
                    <p><input type="text" class="form-control" value="1" name="count" style="width:70px; height:35px; font-size: 15px;">
                    
                        <button class="btn btn-default" style=" width:85px; h0peight: 35px; font-size:15px;">修改数量</button></p>
                    
                </div>
            </div>
                            </form><br><br><br>
            <div>
                <a href="gbbi?id=<%=book.getId()%>" target="blank"style=" font-size: 20px;">详情</a>&nbsp;&nbsp;&nbsp;
                <a href="dcas?id=<%=book.getId()%>" style=" font-weight: bold;" class="btn btn-danger">删除</a>
                <a href="Buy.jsp?bookid=<%=book.getId()%>" target="blank" style="font-weight: bold;" class="btn btn-success">购买</a>
                            <a href="cs?bookid=<%=book.getId()%>" class="btn btn-primary">收藏</a>
                            
            </div>
                        </div>

                    </div>

                    <%
                        i++;
                        }
                    %>
                </div>
        
        </div>
        </div>
    </body>
</html>